package com.service;

import com.dao.BlogDao;
import com.dao.BlogDaoImpl;
import com.entity.Blog;

import java.util.List;

/**
 * @Description TODO
 * @Author hyl
 * @Date 2022/6/21 10:06
 **/
public class BlogServiceImpl implements BlogService {

	BlogDao blogDao = new BlogDaoImpl();

	@Override
	public List<Blog> findAll() {
		return blogDao.findAll();
	}

	@Override
	public List<Blog> findByParam(Integer uid, Integer state, String content) {
		return blogDao.findByParam(uid,state,content);
	}

	@Override
	public Blog findById(Integer id) {
		return blogDao.findById(id);
	}

	@Override
	public int add(Blog blog) {
		return blogDao.add(blog);
	}

	@Override
	public int update(Blog blog) {
		return blogDao.update(blog);
	}

	@Override
	public int deleteById(Integer id) {
		//判断博客是否有从表引用

		//如果有，先删除从表==》再删除主表

		//评论
		//点赞
		//收藏

		//博客

		return blogDao.deleteById(id);
	}
}
